/* eslint-disable keyword-spacing,indent */
// +----------------------------------------------------------------------
// | CmsWing [ 网站内容管理框架 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015-2115 http://www.cmswing.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: arterli <arterli@qq.com>
// +----------------------------------------------------------------------

module.exports = class extends think.cmswing.home {
  // 我要了解
  async indexAction() {
    const id = this.is_login;
    const fabuid = this.get('id');
    const memberinfo = await this.model('member').where({id: id}).find();
    const gongxuinfo = await this.model('gongxufabu').where({id: fabuid}).find();
    const data = {
      model: 8,
      uid: id,
      real_name: memberinfo.real_name,
      usermobile: memberinfo.mobile,
      usergsmc: memberinfo.gsmc,
      xinxibiaoti: gongxuinfo.xinxibiaoti,
      gongxuid: fabuid,
      title: '我要了解',
      time: new Date().getTime()
    };
    const id2 = await this.model('consult').add(data);
    if (!id2) think.logger.info('我要了解失败', id, fabuid);
    return this.display();
  }
};
